<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	
	<body>
		<div id="app">
			<input type="text"  v-model="num1"/>
		<select v-model="op">
			<option>+</option>
			<option>-</option>
			<option>*</option>
			<option>/</option>
		</select>
		<input type="text" v-model="num2"/>
		<button v-on:click="calc">=</button>
		<input type="text" v-model="result" />
		</div>
		<script>
			var app = Vue.createApp({
				data() {
					return {
						num1:'',
						num2:'',
						result:'',
						op:''
					}
				},
			methods:{
					calc:function(){
					if(this.op=="+")
					{
						console.log("执行加法")
						var x = parseInt(this.num1)
						var y = parseInt(this.num2)
						var z = x+y;
						this.result = z;
					}
					else if(this.op=="-")
					{
						console.log("执行减法")
						var x = parseInt(this.num1)
						var y = parseInt(this.num2)
						var z = x-y;
						this.result = z;
					}
					else if(this.op=="*")
					{
						console.log("执行乘法")
						var x = parseInt(this.num1)
						var y = parseInt(this.num2)
						var z = x*y;
						this.result = z;
					}
					else if(this.op=="/")
					{
						console.log("执行除法")
						var x = parseInt(this.num1)
						var y = parseInt(this.num2)
						var z = x/y;
						this.result = z;
					}
				}
				}
			});
			var vm = app.mount("#app")
		</script>
	</body>
</html>
